package com.project.controller;

import com.project.bean.UserBean;
import com.project.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class TestController {
    @Autowired
    private IUserService service;

    @RequestMapping("/abc")
    @ResponseBody
    public String add(){
        return "执行添加";
    }

    @RequestMapping("/register")
    public String registerUser(UserBean user, int price,@RequestParam("name") String userName){
        System.out.println(user + "  " + price + "  " + userName);
        System.out.println("执行业务方法，结果：" + service.getInfo());
        return "redirect:/html/info.html";
    }
}
